<template>
	<view class='money-detail-container dp-flex-col'>
		<view v-if="lists!==''">
			<view v-for="(item,index) in lists">
				<view class='weui-cell'>
					<view class="weui-cell__hd"></view>
					<view class="weui-cell__bd dp-flex-col">
						<text>{{item.type}}</text>
						<text class='small-size'>{{item.created_at}}</text>
					</view>
					<view class="weui-cell__ft red-color">{{item.change_amount}}</view>
				</view>
				<view class='comments' v-if="item.comment">失败原因：{{item.comment}}</view>
			</view>
		</view>
		<view v-else>
			<view class='comments zj_info' >暂无资金记录</view>
		</view>
	</view>
</template>

<script>
	/*引入基类文件*/
	import app from '@/App.vue';
	import event from '@/utils/event.js';
	/*引入接口文件*/
	import {
		GYZJMODEL as gyzjModel
	} from '@/utils/gyzjModel.js';
	export default {
		onLoad() {
			var arr = this.main_getGlobal();
			this.getMoneyRecord(1, arr.token,arr.type);
		},
		data() {
			return {
				lists: [],
				page: 1,
				pageCount: 1,
			}
		},
		methods: {
			
			// 查询金额记录
			getMoneyRecord: function(page, token, type, loadMore) {
				
				uni.showLoading();
				gyzjModel.prototype.getMoneyRecord(page, token, type, loadMore).then(data => {
					switch (data.code) {
						case 1:
							uni.hideLoading();
							let lists = this.lists;
							if (loadMore) {
								lists = lists.concat(data.data.data);
							} else {
								lists = data.data.data;
							}
							this.lists=lists;
							this.pageCount= data.data.page_count;
							break;
						default:
							uni.hideLoading();
							uni.showToast({
								title: data.message,
								icon: 'none'
							})
							break;
					}
				});
			},

		}

	}
</script>

<style>
	@import url("../../../../static/style/app.css");
	.zj_info{
		text-align:center;
		height:15vh;
		line-height:15vh;
	}
	.money-detail-container {
		background-color: #fff;
	}

	.weui-cell {
		border-bottom: 1px solid #e5e5e5;
	}

	.weui-cell__hd {
		margin-right: 20upx;
	}

	.comments {
		padding: 0upx 30upx;
		color: #888;
		font: 28upx;
	}

	.small-size {
		font-size: 24upx;
		color: #b2b2b2;
		margin-top: 5px;
	}
</style>
